<?php

/**
 * Application Models
 *
 * @package Application_Model
 * @subpackage Model
 * @author <SONIA ZRIBI>
 * @copyright ZF model generator
 * @license http://framework.zend.com/license/new-bsd     New BSD License
 */

/**
 * Abstract class for models
 */
require_once 'ModelAbstract.php';

/**
 * 
 *
 * @package Application_Model
 * @subpackage Model
 * @author <SONIA ZRIBI>
 */
class Application_Model_ConfigColonneStat extends Application_Model_ModelAbstract
{

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdconfigColonneStat;

    /**
     * Database var type varchar(100)
     *
     * @var string
     */
    protected $_NomColonne;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_Type;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_Ordre;

    /**
     * Database var type varchar(45)
     *
     * @var string
     */
    protected $_Saisir;

    /**
     * Database var type varchar(100)
     *
     * @var string
     */
    protected $_Champwebservice;

    /**
     * Database var type int(11)
     *
     * @var int
     */
    protected $_IdconfigStat;


    /**
     * Parent relation fk_config_colonne_stat_config_stat1
     *
     * @var Application_Model_ConfigStat
     */
    protected $_ConfigStat;


    /**
     * Dependent relation fk_datastat_config_colonne_stat1
     * Type: One-to-Many relationship
     *
     * @var Application_Model_Datastat
     */
    protected $_Datastat;

    /**
     * Sets up column and relationship lists
     */
    public function __construct()
    {
        parent::init();
        $this->setColumnsList(array(
            'idconfig_colonne_stat'=>'IdconfigColonneStat',
            'nom_colonne'=>'NomColonne',
            'type'=>'Type',
            'ordre'=>'Ordre',
            'saisir'=>'Saisir',
            'champwebservice'=>'Champwebservice',
            'idconfig_stat'=>'IdconfigStat',
        ));

        $this->setParentList(array(
            'FkConfigColonneStatConfigStat1'=> array(
                    'property' => 'ConfigStat',
                    'table_name' => 'ConfigStat',
                ),
        ));

        $this->setDependentList(array(
            'FkDatastatConfigColonneStat1' => array(
                    'property' => 'Datastat',
                    'table_name' => 'Datastat',
                ),
        ));
    }

    /**
     * Sets column idconfig_colonne_stat
     *
     * @param int $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setIdconfigColonneStat($data)
    {
        $this->_IdconfigColonneStat = $data;
        return $this;
    }

    /**
     * Gets column idconfig_colonne_stat
     *
     * @return int
     */
    public function getIdconfigColonneStat()
    {
        return $this->_IdconfigColonneStat;
    }

    /**
     * Sets column nom_colonne
     *
     * @param string $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setNomColonne($data)
    {
        $this->_NomColonne = $data;
        return $this;
    }

    /**
     * Gets column nom_colonne
     *
     * @return string
     */
    public function getNomColonne()
    {
        return $this->_NomColonne;
    }

    /**
     * Sets column type
     *
     * @param string $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setType($data)
    {
        $this->_Type = $data;
        return $this;
    }

    /**
     * Gets column type
     *
     * @return string
     */
    public function getType()
    {
        return $this->_Type;
    }

    /**
     * Sets column ordre
     *
     * @param int $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setOrdre($data)
    {
        $this->_Ordre = $data;
        return $this;
    }

    /**
     * Gets column ordre
     *
     * @return int
     */
    public function getOrdre()
    {
        return $this->_Ordre;
    }

    /**
     * Sets column saisir
     *
     * @param string $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setSaisir($data)
    {
        $this->_Saisir = $data;
        return $this;
    }

    /**
     * Gets column saisir
     *
     * @return string
     */
    public function getSaisir()
    {
        return $this->_Saisir;
    }

    /**
     * Sets column champwebservice
     *
     * @param string $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setChampwebservice($data)
    {
        $this->_Champwebservice = $data;
        return $this;
    }

    /**
     * Gets column champwebservice
     *
     * @return string
     */
    public function getChampwebservice()
    {
        return $this->_Champwebservice;
    }

    /**
     * Sets column idconfig_stat
     *
     * @param int $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setIdconfigStat($data)
    {
        $this->_IdconfigStat = $data;
        return $this;
    }

    /**
     * Gets column idconfig_stat
     *
     * @return int
     */
    public function getIdconfigStat()
    {
        return $this->_IdconfigStat;
    }

    /**
     * Sets parent relation IdconfigStat
     *
     * @param Application_Model_ConfigStat $data
     * @return Application_Model_ConfigColonneStat
     */
    public function setConfigStat(Application_Model_ConfigStat $data)
    {
        $this->_ConfigStat = $data;

        $primary_key = $data->getPrimaryKey();
        if (is_array($primary_key)) {
            $primary_key = $primary_key['idconfig_stat'];
        }

        $this->setIdconfigStat($primary_key);

        return $this;
    }

    /**
     * Gets parent IdconfigStat
     *
     * @param boolean $load Load the object if it is not already
     * @return Application_Model_ConfigStat
     */
    public function getConfigStat($load = true)
    {
        if ($this->_ConfigStat === null && $load) {
            $this->getMapper()->loadRelated('FkConfigColonneStatConfigStat1', $this);
        }

        return $this->_ConfigStat;
    }

    /**
     * Sets dependent relations fk_datastat_config_colonne_stat1
     *
     * @param array $data An array of Application_Model_Datastat
     * @return Application_Model_ConfigColonneStat
     */
    public function setDatastat(array $data)
    {
        $this->_Datastat = array();

        foreach ($data as $object) {
            $this->addDatastat($object);
        }

        return $this;
    }

    /**
     * Sets dependent relations fk_datastat_config_colonne_stat1
     *
     * @param Application_Model_Datastat $data
     * @return Application_Model_ConfigColonneStat
     */
    public function addDatastat(Application_Model_Datastat $data)
    {
        $this->_Datastat[] = $data;
        return $this;
    }

    /**
     * Gets dependent fk_datastat_config_colonne_stat1
     *
     * @param boolean $load Load the object if it is not already
     * @return array The array of Application_Model_Datastat
     */
    public function getDatastat($load = true)
    {
        if ($this->_Datastat === null && $load) {
            $this->getMapper()->loadRelated('FkDatastatConfigColonneStat1', $this);
        }

        return $this->_Datastat;
    }

    /**
     * Returns the mapper class for this model
     *
     * @return Application_Model_Mapper_ConfigColonneStat
     */
    public function getMapper()
    {
        if ($this->_mapper === null) {
            $this->setMapper(new Application_Model_Mapper_ConfigColonneStat());
        }

        return $this->_mapper;
    }

    /**
     * Deletes current row by deleting the row that matches the primary key
     *
	 * @see Application_Model_Mapper_ConfigColonneStat::delete
     * @return int|boolean Number of rows deleted or boolean if doing soft delete
     */
    public function deleteRowByPrimaryKey()
    {
        if ($this->getIdconfigColonneStat() === null) {
            throw new Exception('Primary Key does not contain a value');
        }

        return $this->getMapper()
                    ->getDbTable()
                    ->delete('idconfig_colonne_stat = ' .
                             $this->getMapper()
                                  ->getDbTable()
                                  ->getAdapter()
                                  ->quote($this->getIdconfigColonneStat()));
    }
}
